#自动取款机

username = "chenaitai"
password = "123456"
login = False  #设置变量，是否成功登录
acount = 888888

#定义函数，显示账号信息
def show():
	print("{0:1} {1:4} {2:6} {3:1} {4:4}".format("尊敬的",username,"您好，","你帐户目前的余额为：",acount))
	print("="*60)


while True:
	name = input("请输入需要登录的用户名：")
	mima = input("请输入你的密码：")
	if name == username and mima == password:
		login = True
		break
	print("用户名或密码错误，请重新输入！")
	print('='*40)


while login:
    #输出初始界面
    print("="*12,"自动取款机管理系统","="*14)
    print("{0:1} {1:13} {2:15}".format(" ","1. 查询余额","2. 取钱"))
    print("{0:1} {1:15} {2:15}".format(" ","3. 存钱","4. 退出"))
    print("="*40)
    key = input("请输入对应的选择：")
    #根据key，判断并执行对应的操作
    if key == '1':
        print("="*12,"账号余额查询","="*14)
        show()
        input("按回车键继续......")
    elif key == '2':
        print("="*12,"提取现金","="*14)
        num1 = input("请输入要取的现金额：")
        acount -= int(num1)
        show()
        input("按回车键继续......")
    elif key == '3':
        print("="*12,"存入现金","="*14)
        num2 = input("请输入要取的现金额：")
        acount += int(num2)
        show()
        input("按回车键继续......")
    elif key == '4':
        print("="*12,"再见","="*14)
        break
    else:
        print("======== 无效的键盘输入！ ==========")





